<?php
declare (strict_types = 1);

namespace app\api\model;

use think\Model;
use think\model\concern\SoftDelete;

/**
 * @mixin \think\Model
 */
class Spec extends Model
{
    //use SoftDelete;
    /**
     * 模型与属性的关系：一个模型对应多个属性
     * @return \think\model\relation\HasMany
     */
    public function specValue(){
        return $this->hasMany(SpecValue::class,"spec_id");
    }
    public static function getTypeIdByDeleteSpec($typeId){
        return self::where("type_id",$typeId)->delete();
    }
    /**
     * 商品规格名称入库
     * @param $data
     * @return \think\Collection
     * @throws \Exception
     */
    public function addSpec($data){
        return $this->saveAll($data);
    }

}
